package com.example.computer_exam_training_sys.service.impl;

import com.example.computer_exam_training_sys.entity.UserPracticeDetail;
import com.example.computer_exam_training_sys.mapper.UserPracticeDetailMapper;
import com.example.computer_exam_training_sys.service.UserPracticeDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserPracticeDetailServiceImpl implements UserPracticeDetailService {

    @Autowired
    private UserPracticeDetailMapper detailMapper;

    @Override
    public List<UserPracticeDetail> getAllPracticeDetails() {
        return detailMapper.getAllPracticeDetails();
    }

    @Override
    public List<UserPracticeDetail> getDetailsByPracticeId(Integer practice_id) {
        // ✅ 调用实际存在的方法 selectByPracticeId
        return detailMapper.selectByPracticeId(practice_id);
    }

    @Override
    public int addPracticeDetail(UserPracticeDetail detail) {
        return detailMapper.insertPracticeDetail(detail);
    }
}
